<template>
    <view>
         <u--textarea v-model="textarea" placeholder="请输入内容" height="500" count></u--textarea>
         <view class="confirmBtn" @click="handleConfirm">提交</view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                title: "评论界面",
				textarea: '',
				good_id:-1
            }
        },
		onLoad: function (options) {//此处接收传递过来的参数wx.navigateTo跳转时传递的参数
		    this.good_id = options.good_id
		},
		methods:{
			async handleConfirm(){
				if(this.inpVal===''){
					uni.showToast({
						icon:'error',
						title:'内容不能为空',
						duration:1000
					})
				}else{
					const res = await this.$myRequest({
						url: '/api/liuyan/add',
						method:'post',
						data: {good_id:this.good_id,textarea:this.textarea}
					})
					uni.navigateTo({
						url: `/pages/good-detail/good-detail?id=${this.good_id}`
					})
				}
			}
		}
    }
</script>

<style scoped>
.confirmBtn {
width: 90%;
height: 100rpx;
background-color: #009fe9;
border-radius: 10rpx;
color: #fff;
text-align: center;
line-height: 100rpx;
margin: 30rpx;
box-shadow: 2rpx 2rpx 5rpx #cccccc;
}
</style>

